<template>
	<div class="detail">
		<div class="banner"></div>
		<div class="tab-box">
			<div class="tab-wrap">
				<div class="tab-menu">
					<div class="tab-item active">详细内容</div>
				</div>
			</div>
		</div>
		<div class="tab-content">
			<div class="content-wrap">
				<div class="detail-box">
					<div class="detail-title">{{ detail.title }}</div>
					<div class="sub-box">
						<div class="date">日期：{{ detail.date }}</div>
						<div class="origin">来源：{{ detail.origin }}</div>
					</div>
					<div class="content" v-html="detail.content"></div>
					<div class="recommend">
						<img src="@/assets/images/icons/zan.png" alt="" class="dz">
						<!-- <img src="@/assets/images/icons/zan-h.png" alt="" class="dz"> -->
						<span>赞一下</span>
					</div>
				</div>
				<!-- 评论 -->
				<div class="comment-box">
					<div class="comment-head">
						<img class="comment-icon" src="@/assets/images/icons/comment.png" alt="">
						<span>评论</span>
					</div>
					<div class="comment-content">
						<div class="comment-textarea">
							<el-input
							v-model="commentForm.content"
							:disabled="!isLogin"
							type="textarea"
							:rows="2"
							placeholder="请输入内容"
							>
							</el-input>
						</div>
						<div class="comment-tip" v-if="!isLogin">登录后评论</div>
						<div class="comment-bar" v-else>
							<div class="btns">
								<el-button type="danger" @click="handleAddComment()">提交</el-button>
							</div>
						</div>
					</div>
					<div class="comment-list-box">
						<div class="comment-list" v-for="(item, index) in commentList" :key="index">
							<div class="c-content">
								<img src="@/assets/images/avator.png" alt="" class="avator">
								<div class="c-info-box">
									<div class="c-name">{{ item.createBy }} {{ item.reviewDate}}</div>
									<div class="comment">{{ item.content }}</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	name: 'Detail',
	data() { 
		return {
			//是否登录
			isLogin: true,
			//详情
			detail: {},
			//评论
			commentForm: {
				content: ''
			},
			//评论列表
			commentList: []
		}
	},
	mounted() { 
		this.queryDetail();
		this.queryCommentData();
	},
	methods: {
		/**
		 * 详情查询
		 */
		queryDetail() { 
			let detail = {
				id: 1,
				title: '魏臻教授获评2024年安徽“十大新闻人物”',
				content: `<p>近日，由安徽日报社主办的2024年度安徽“十大新闻人物”评选揭晓。我校教授、博士生导师，合肥工大高科信息科技股份有限公司董事长魏臻荣登榜单。</p>
				<p>魏臻长期奋战科研一线，在铁路信号与智能调度、智能化矿山建设等领域取得多项关键核心技术突破，推动了我国铁路信号控制关键装备国产化；带领团队成功研制国内首套企业铁路智能运输调度综合信息平台，
				彻底改变了我国工业铁路运输调度依靠人工的管理模式；研制出符合中国铁路技术标准和欧洲铁路安全标准的最新一代计算机联锁系统，在国内近百家大型企业和共建“一带一路”国家推广应用。魏臻以不畏艰难、敢为人先的创新精神、
				执着专注精益求精的工匠精神，不断攀登一个又一个科技“高峰”，先后荣获全国杰出专业技术人才、国家创新人才推进计划科技创新创业人才、安徽省优秀民营企业家等称号。</p>`,
				imageUrl: require('@/assets/images/part1/part1-01.jpg'),
				date: '2025-01-17',
				origin: 'xx学院'
			}
			this.detail = detail;
		},
		/**
		 * 查询评论数据
		 */
		queryCommentData() { 
			let commentList = [
				{ content: '不错呀',createBy:'张三', reviewDate: '2025-01-24 10:20:32' }
			];
			this.commentList = commentList;
		},
		/**
		 * 提交评论
		 */
		handleAddComment() { 

		}
	}
}
</script>

<style lang="scss" scoped>
.detail {
	width: 100%;
	min-height: 760px;
	.banner {
		width: 100%;
		height: 140px;
		background-image: url('~@/assets/images/list-banner.png');
		background-repeat: no-repeat;
		background-size: cover;
		background-position: -100px;
	}
	.tab-box {
		width: 100%;
		height: 60px;
		background-color: #fff;
		border-bottom: 1px solid #e0e0e0;
		.tab-wrap {
			display: flex;
			width: 1460px;
			height: 100%;
			margin: 0 auto;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
		}
		.tab-menu {
			display: flex;
			height: 100%;
			flex-direction: row;
			align-items: center;
			.tab-item {
				display: flex;
				font-size: 18px;
				font-weight: bold;
				width: 150px;
				text-align: center;
				transition: all .2s;
				cursor: pointer;
				letter-spacing: 2px;
				&.active {
					color: #a6292f;
					font-size: 20px;
				}
			}
		}
	}
	.tab-content {
		width: 100%;
		background: rgba(255,255,255, .9);
		.content-wrap {
			width: 1460px;
			margin: 0 auto;
			padding: 30px 0 50px 0;
		}
		.detail-box {
			width: 100%;
			.detail-title {
				width: 100%;
				font-size: 24px;
				color: #222;
				text-align: center;
				line-height: 36px;
				margin-bottom: 30px;
			}
			.sub-box {
				width: 100%;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: center;
				font-size: 14px;
				color: #666;
				border-bottom: 1px solid #d5d5d5;
				padding-bottom: 15px;
				.date {
					margin-right: 100px;
				}
			}
			.content {
				padding-top: 20px;
				color: #333;
				line-height: 32px;
				font-size: 16px;
				text-indent: 32px;
				img {
					margin: 0 auto;
					width: 600px;
				}
			}
		}
	}
	.recommend {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: flex-end;
		font-size: 14px;
		padding: 20px 4px 0 0;
		> img {
			width: 20px;
			margin-right: 5px;
			cursor: pointer;
		}
	}
	.comment-box {
		width: 100%;
		margin-top: 50px;
		.comment-head {
			display: flex;
			flex-direction: row;
			align-items: center;
			border-bottom: 2px solid #a6292f;
			padding-bottom: 8px;
			.comment-icon {
				width: 26px;
				margin-right: 5px;
			}
			span {
				font-size: 18px;
			}
		}
		.comment-content {
			width: 100%;
			padding-top: 20px;
			.comment-textarea {
				width: 100%;
				height: 80px;
				border: 1px solid #ededed;
				.el-textarea {
					height: 100%;
				}
			}
			.comment-tip {
				width: 100%;
				height: 40px;
				line-height: 40px;
				padding-left: 5px;
				border: 1px solid #ededed;
				border-top: 0;
				font-size: 14px;
				color: #666;
			}
			.comment-bar {
				width: 100%;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				padding-top: 20px;
			}
		}
		.comment-list-box {
			width: 100%;
			margin-top: 40px;
			.comment-list {
				width: 100%;
				margin-bottom: 30px;
				.c-content {
					width: 100%;
					display: flex;
					flex-direction: row;
					.avator {
						width: 40px;
						height: 40px;
					}
					.c-info-box {
						padding-left: 15px;
						flex: 1;
						.c-name {
							color: #999;
							font-size: 14px;
							margin-bottom: 5px;
						}
						.comment {
							font-size: 14px;
							color: #333;
						}
					}
				}
			}
		}
	}
}
::v-deep .comment-box .el-textarea__inner {
	height: 100%;
	border-radius: 0;
}
::v-deep .el-button--danger {
	background-color: #a6292f !important;
	border-color: #a6292f !important;
}
</style>